
// 获取state中的数据，不能改变数据的值
const getters = {
    // 获取用户名
    name: state => state.user.name,
    // 获取token
    token: state => state.user.token,
    // 获取用户头像
    avatar: state => state.user.avatar,
    // 获取用户编号
    uid: state => state.user.uid,
    // 返回用户信息
    user: state => {
        let user = {
            uid: state.user.uid,
            name: state.user.name,
            avatar: state.user.avatar
        };
        return user;
    }
};

export default getters;